package frog.whacker;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class FrogWhacker extends Activity {
	 /** Called when the activity is first created. */
   private Button begingame;
   private Button difficulty;
   public static int diffset = 1;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        this.setContentView(R.layout.main);
        
        this.begingame = (Button)findViewById(R.id.Frog_Whacker);
        this.difficulty = (Button)findViewById(R.id.diff_button);
        registerForContextMenu(difficulty);
        
        this.begingame.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
            	Intent myIntent = new Intent(FrogWhacker.this, Game.class);
            	FrogWhacker.this.startActivity(myIntent);
            }
          });
        this.difficulty.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
            	v.showContextMenu();
            }
          });
    }
	public void onCreateContextMenu(ContextMenu menu, View v,ContextMenuInfo menuInfo) {  
		super.onCreateContextMenu(menu, v, menuInfo);  
		    menu.setHeaderTitle("Difficulty");  
		    menu.add(0, v.getId(), 0, "Easy");  
		    menu.add(0, v.getId(), 0, "Medium");  
		    menu.add(0, v.getId(), 0, "Hard");  
		} 
	public boolean onContextItemSelected(MenuItem item) {  
        if(item.getTitle()=="Easy")
        {
        	diffset = 1;
        	this.difficulty.setText(R.string.diff_easy);
        }  
        else if(item.getTitle()=="Medium")
        {
        	diffset = 2;
        	this.difficulty.setText(R.string.diff_medium);
        }  
        else if(item.getTitle()=="Hard")
        {
        	diffset = 3;
        	this.difficulty.setText(R.string.diff_hard);
        }  
        else 
        {
        	return false;
        }  
		return true;  
	}  
}